﻿

@if (funnelData == null)
{
	<Loading></Loading>
}
else
{
	<Funnel @ref=_chart Data="funnelData" Config="config" />
}



@code {

	public class FunnelData
	{
		public string action;
		public int pv;
	}
	[Parameter]
	public object[] funnelData{ get; set; }
	[Parameter]
	public int height { get; set; }
	[Parameter]
	public int width { get; set; }

	private IChartComponent _chart;

	protected override async void OnParametersSet()
	{
		config.Height = height;
		config.Width = width;
		if (_chart != null)
		{
			await _chart.ChangeData(funnelData);
		}

		base.OnParametersSet();
	}
	readonly FunnelConfig config = new FunnelConfig
	{
			XField = "action",
			YField = "pv",
			DynamicHeight=true,
			AutoFit=true,
		
    };
}
